import Vue from 'vue'
import App from './App'
import wLoading from "@/component/w-loading.vue";
import store from './store'
// import "./utils/wpkReporter.js"
// import "./utils/perform.js"
import '@/utils/mwUtils/phototype.js'
import {
	getFormFieldsValue,
	getGeocoder,
	getDistance,
	loadingState,
	hideLoading,
	navTo,
	showToastOrNavTo,
	scanCode
} from '@/utils/util'


// import VConsole from 'vconsole';
// new VConsole();

import Aplus from './utils/Aplus'

let appId = "2002238523";
let appName = "取号预约";

/*不用管，复制丢进去就行*/
let $Aplus = new Aplus(appId, appName)
// 执行通用埋点
$Aplus.general();
// 执行路由埋点
function aplus() {
	aplus_queue.push({
		action: 'aplus.setMetaInfo',
		arguments: ['aplus-waiting', 'MAN']
	});
	aplus_queue.push({
		'action': 'aplus.sendPV',
		'arguments': [{
			is_auto: false
		}, {
			miniAppId: appId,
		}]
	})
}
Vue.mixin({
	onShow() {
		aplus()
	}
})
Vue.prototype.$Aplus = $Aplus

Vue.prototype.$centerId = 123;
Vue.prototype.$store = store;
Vue.prototype.showToastOrNavTo = showToastOrNavTo;
Vue.prototype.scanCode = scanCode;
Vue.component('w-loading', wLoading);

// 线上服务器
// var baseUrl = "https://25826731an.goho.co/m2/1175022-0-default";
// var baseUrl = "https://25826731an.goho.co/";
// var baseUrl = "";
var baseUrl = "https://www.xsbsfwzx.com/zlb/";
var imgUrl = "https://www.fykjlw.com/lw-partner/file/downFile?id=";
var socketUrl = "wss://www.fykjlw.com/lw-partner/websocket";

// var baseUrl = "https://www.fykjlw.com:8000/test/lw-partner";
// var imgUrl = "https://www.fykjlw.com:8000/test/lw-partner/file/downFile?id=";
// var socketUrl = "wss://www.fykjlw.com:8000/test/lw-partner/websocket";

// 本地192.168.1.126:8200
// var baseUrl = "http://192.168.1.126:8200/lw-partner";
// var imgUrl = "http://192.168.1.126:8200/lw-partner/file/downFile?id=";
// var socketUrl = "wss://http://192.168.1.126:8200/lw-partner/websocket";

var addressKey = 'LPRBZ-KNBR6-IBKSY-EZNGX-OZGCE-FKBDK';
// var baseUrl = "http://feiyekeji.f3322.net:62300";
Vue.prototype.baseUrl = baseUrl; /* 根域名不同 */
import {
	http
} from '@/utils/luch-request/index.js' // 全局挂载引入，配置相关在该index.js文件里修改
http.setConfig((config) => {
	/* 设置全局配置 */
	config.baseUrl = baseUrl; /* 根域名不同 */
	config.header = {};
	console.log("1 " + uni.getStorageSync('rbacToken'))
	// config.rbacToken = "0c8649aa836b4ecc98d0dd970ac61d1d";
	config.rbacToken = uni.getStorageSync('rbacToken');
	return config
})
Vue.prototype.$http = http;
Vue.prototype.$getGeocoder = getGeocoder;
Vue.prototype.$getDistance = getDistance;

//封装公共路径跳转的方法
Vue.prototype.navTo = navTo;
Vue.prototype.imgUrl = imgUrl;
Vue.prototype.socketUrl = socketUrl;
Vue.config.productionTip = false;
// 封装form表单获取字段的方法
Vue.prototype.getFormFieldsValue = getFormFieldsValue;
Vue.prototype.loadingState = loadingState;
Vue.prototype.hideLoading = hideLoading;


//封装默认加载字段的方法
Vue.prototype.loadDefaultList = function (_this, list) {
	list.map(function (item) {
		_this.$store.dispatch("requestData", item)
	})
}

ZWJSBridge.onReady(() => {
	ZWJSBridge.getUiStyle().then((result) => {
	  	window.document.querySelector('body').id = result.uiStyle;
	});
});

App.mpType = 'app'

const app = new Vue({
	...App
})
app.$mount()